package main

import "fmt"

type Appliance interface {
	TurnOn()
	TurnOff()
}

type Television struct{}

func (tv *Television) TurnOn() {
	fmt.Println("Turning on the television.")
}

func (tv *Television) TurnOff() {
	fmt.Println("Turning off the television.")
}

type Fan struct{}

func (f *Fan) StartRotate() {
	fmt.Println("Starting to rotate the fan.")
}

func (f *Fan) StopRotate() {
	fmt.Println("Stopping to rotate the fan.")
}

type FanAdapter struct {
	fan *Fan
}

func (f FanAdapter) TurnOn() {
	f.fan.StartRotate()
}

func (f FanAdapter) TurnOff() {
	f.fan.StopRotate()
}

func CreateFanAdapter(fan *Fan) Appliance {
	return &FanAdapter{fan: fan}
}
func main() {
	adapter := CreateFanAdapter(&Fan{})
	adapter.TurnOn()
	adapter.TurnOff()
}
